package com.hzh.controller;

import com.hzh.entity.Order;
import com.hzh.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("order")
public class OrderController {

    //依赖于service层
    @Autowired
    private OrderService orderService;

    @RequestMapping("find")
    public ModelAndView find(ModelAndView modelAndView){
        List<Order> allList = orderService.findAll();
        modelAndView.addObject("allList",allList);
        modelAndView.setViewName("list");
        return modelAndView;
    }
}
